#ifndef _DWARF_FORT_INTERFACE_H
#define _DWARF_FORT_INTERFACE_H
#include <Ogre.h>
#include <string>
#include <OIS/OIS.h>

#include "StandardDefines.h"


namespace CEGUI
{
	class EventArgs;
}


namespace DwarfFort
{

	struct DwarfFortScreen;
	struct DwarfFortStatic;
	struct ActionStruct;
	struct ComboString;
	struct MapCell;
	struct MatGlossList;
	class StateMirror;
	class StateListener;
	class MapCellList;

	struct IconDesc
	{
		Ogre::RGBA FGColor;
		Ogre::RGBA BGColor;
		DWORD icon;
	};

	class Interface :public Ogre::Singleton<Interface>//, OIS::KeyListener 
	{
		DwarfFortScreen *mScreen;
		DwarfFortStatic *mStatic;
		MapCellList *mCellList;
		StateMirror *mStateMirror;

		MatGlossList *mMatGlossList;

		ActionStruct *mActions;
		DWORD mActionCount;
		OIS::Keyboard *mKeyboard;
		ComboString *mStrings;
		bool mActive;
		
		


		int mEnterPressed;
		int mEnterNotPressed;

		void setupStaticStructures();
		
	public:
		Interface(void);
		~Interface(void);

		void updateTimer();
		bool checkGameTimer();
		bool checkRenderTimer();

		void fillIconDesc(IconDesc &res,int loc);
		void fillIconDesc(IconDesc &res,int row,int col) { fillIconDesc(res,row*25+col);}

		SHORT GetKey(int nVirtKey);
		void connectToDwarfFort();
		void PatchGame();
		bool DwarfFortSetup();
		bool DwarfFortGameLoop();
		void ConnectScreen();

		void setKeyboard(OIS::Keyboard *keyboard);
		
		eGameState getCurrentGameState();
		
		const StateMirror* getStateMirror() {return mStateMirror;}

		bool keyPressed(const CEGUI::EventArgs& e);
		bool keyReleased(const CEGUI::EventArgs& e);

		bool isMapLoaded();
		
		MapCellList *getMapCellList() {return mCellList;}

		DwarfFortScreen *getScreen() {return mScreen;}

		MatGlossList *getMatGlossList() {return mMatGlossList;}

		void registerStateListener(StateListener *listener,eGameState gameState);
		void unRegisterStateListener(StateListener *listener,eGameState gameState);
	}; // class Interface

} // namespace DwarfFort

#endif